<?php

require_once './application/core/CoreBase.php';
require_once './application/models/Objets/Utilisateur.php';

class LangCore extends CoreBase
{

    protected $_session;
    private $_configPath;
    private $_lang;

    public function __construct(&$controller)
    {
        parent::__construct($controller);
        $session = new Zend_Session_Namespace('session');
        if (!empty($session->lang))
        {
            $this->_configPath = './application/configuration/langage/' . $session->lang . '.ini';
            $this->_lang = new Zend_Config_Ini($this->_configPath, null);
        }
    }

    public function putConstant()
    {
        @DEFINE('VISUALISATION_TITLE_SEARCH', $this->_lang->visualisation->title->search);
        @DEFINE('VISUALISATION_BODY_SEARCH_IP', $this->_lang->visualisation->body->search->ip);
        @DEFINE('VISUALISATION_BODY_SEARCH_MASK', $this->_lang->visualisation->body->search->mask);
        @DEFINE('VISUALISATION_BODY_SEARCH_EXAMPLE', $this->_lang->visualisation->body->search->example);
        @DEFINE('VISUALISATION_TITLE_CREATION', $this->_lang->visualisation->title->creation);
        @DEFINE('VISUALISATION_TITLE_LOG', $this->_lang->visualisation->title->log);
        @DEFINE('VISUALISATION_TITLE_BACKUP', $this->_lang->visualisation->title->backup);
        @DEFINE('VISUALISATION_TITLE_RESTORE', $this->_lang->visualisation->title->restore);
        @DEFINE('VISUALISATION_TITLE_COMMAND', $this->_lang->visualisation->title->command);
        @DEFINE('VISUALISATION_BODY_SEARCH_EMPTY', $this->_lang->visualisation->body->search->empty);
        @DEFINE('VISUALISATION_BODY_SEARCH_STOP', $this->_lang->visualisation->body->search->stop);
        @DEFINE('VISUALISATION_BODY_MONITOR', $this->_lang->visualisation->body->monitor);

        @DEFINE('ADMIN_TITLE_FILTRE', $this->_lang->admin->title->filtre);
        @DEFINE('ADMIN_TITLE_ADMININI', $this->_lang->admin->title->adminini);
        @DEFINE('ADMIN_BODY_ADMININI_SERVER', $this->_lang->admin->body->adminini->server);
        @DEFINE('ADMIN_BODY_ADMININI_DB', $this->_lang->admin->body->adminini->db);
        @DEFINE('ADMIN_BODY_ADMININI_USER', $this->_lang->admin->body->adminini->user);
        @DEFINE('ADMIN_BODY_ADMININI_PASSWORD', $this->_lang->admin->body->adminini->password);
        @DEFINE('ADMIN_BODY_ADMININI_GRAPHIZ', $this->_lang->admin->body->adminini->graphiz);
        @DEFINE('ADMIN_BODY_ADMININI_CACHEGRAPHIZ', $this->_lang->admin->body->adminini->cachegraphiz);
        @DEFINE('ADMIN_BODY_ADMININI_SONDE', $this->_lang->admin->body->adminini->sonde);
        @DEFINE('ADMIN_TITLE_CACHE', $this->_lang->admin->title->cache);
        @DEFINE('ADMIN_TITLE_VERSION', $this->_lang->admin->title->version);
        @DEFINE('ADMIN_BODY_VERSION_NO_UPDATE', $this->_lang->admin->body->version->no->update);
        @DEFINE('ADMIN_BODY_VERSION_UPDATE_TXT', $this->_lang->admin->body->version->update->txt);
        @DEFINE('ADMIN_BODY_VERSION_UPDATE_LINK', $this->_lang->admin->body->version->update->link);

        @DEFINE('USER_TITLE_LOGOUT', $this->_lang->user->title->logout);
        @DEFINE('USER_BODY_LOGOUT', $this->_lang->user->body->logout);
        @DEFINE('USER_TITLE_USERLIST', $this->_lang->user->title->userlist);
        @DEFINE('USER_TITLE_USERRIGHT', $this->_lang->user->title->userright);
        @DEFINE('USER_BODY_USERRIGHT_TEMPLATE', $this->_lang->user->body->userright->template);
        @DEFINE('USER_TITLE_USERNETWORK', $this->_lang->user->title->usernetwork);
        @DEFINE('USER_BODY_USERNETWORK_NETWORK', $this->_lang->user->body->usernetwork->network);
        @DEFINE('USER_BODY_USERNETWORK_ACCOUNT', $this->_lang->user->body->usernetwork->account);
        @DEFINE('USER_BODY_USERNETWORK_PASSWORD', $this->_lang->user->body->usernetwork->password);
        @DEFINE('USER_BODY_USERNETWORK_PASSWORDCONFIG', $this->_lang->user->body->usernetwork->passwordconfig);
        @DEFINE('USER_TITLE_USERGESTION', $this->_lang->user->title->usergestion);
        @DEFINE('USER_BODY_USERGESTION_ADD', $this->_lang->user->body->usergestion->add);
        @DEFINE('USER_BODY_USERGESTION_DEL', $this->_lang->user->body->usergestion->del);
        @DEFINE('USER_BODY_USERGESTION_GESTION', $this->_lang->user->body->usergestion->gestion);
        @DEFINE('USER_TITLE_USERADD', $this->_lang->user->title->useradd);
        @DEFINE('USER_BODY_USERADD_ACCOUNT', $this->_lang->user->body->useradd->account);
        @DEFINE('USER_BODY_USERADD_EMAIL', $this->_lang->user->body->useradd->email);
        @DEFINE('USER_BODY_USERADD_PASSWORD', $this->_lang->user->body->useradd->password);
        @DEFINE('USER_BODY_USERADD_REPASSWORD', $this->_lang->user->body->useradd->repassword);
        @DEFINE('USER_BODY_USERADD_ADMIN', $this->_lang->user->body->useradd->admin);
        @DEFINE('USER_BODY_USERADD_USER', $this->_lang->user->body->useradd->user);
        @DEFINE('USER_BODY_USERADD_LANG', $this->_lang->user->body->useradd->lang);

        @DEFINE('MISC_TITLE_COMFIRM', $this->_lang->misc->title->comfirm);
        @DEFINE('MISC_BODY_COMFIRM', $this->_lang->misc->body->comfirm);
        @DEFINE('MISC_BODY_LIST', $this->_lang->misc->body->list);
        @DEFINE('MISC_BODY_MODEL', $this->_lang->misc->body->model);
        @DEFINE('MISC_BODY_TYPE', $this->_lang->misc->body->type);
        @DEFINE('MISC_BODY_PROTOCOL', $this->_lang->misc->body->protocol);
        @DEFINE('MISC_BODY_IDENTITY', $this->_lang->misc->body->identity);
        @DEFINE('MISC_BODY_CONFIG', $this->_lang->misc->body->config);
        @DEFINE('MISC_BODY_FILTER', $this->_lang->misc->body->filter);
        @DEFINE('MISC_BODY_NAME', $this->_lang->misc->body->name);
        @DEFINE('MISC_BODY_COMMAND', $this->_lang->misc->body->command);
        @DEFINE('MISC_BODY_TAB_DASHBOARD', $this->_lang->misc->body->tab->dashboard);
        @DEFINE('MISC_TITLE_VOLET_MAP', $this->_lang->misc->title->volet->map);
        @DEFINE('MISC_TITLE_VOLET_CONFIG', $this->_lang->misc->title->volet->config);

        @DEFINE('TITLE_CONFIG', $this->_lang->title->config);
        @DEFINE('TITLE_CONSOLE', $this->_lang->title->console);
        @DEFINE('TITLE_LOG', $this->_lang->title->log);
        @DEFINE('TITLE_SONDE', $this->_lang->title->sonde);
        @DEFINE('TITLE_VISUALISATION', $this->_lang->title->visualisation);

        @DEFINE('DASHBOARD_BODY_REFRESH', $this->_lang->dashboard->body->button);
        @DEFINE('DASHBOARD_BODY_INDEX_EMPTY', $this->_lang->dashboard->body->index->empty->link);
        @DEFINE('DASHBOARD_BODY_INDEX_EMPTY_LINK', $this->_lang->dashboard->body->index->empty->link2);
        @DEFINE('DASHBOARD_BODY_INDEX_EMPTY_LINK2', $this->_lang->dashboard->body->index->empty->link3);
        @DEFINE('DASHBOARD_BODY_ERROR_MODULE_UNKNOW', $this->_lang->dashboard->body->error->module->unknow);
        @DEFINE('DASHBOARD_BODY_ERROR_EXECUTE_MODULE', $this->_lang->dashboard->body->error->execute->module);
        @DEFINE('DASHBOARD_BODY_SELECT_TITLE', $this->_lang->dashboard->body->select->title);
        @DEFINE('DASHBOARD_BODY_SELECT_WELCOME', $this->_lang->dashboard->body->select->welcome);
        @DEFINE('DASHBOARD_BODY_SELECT_HELP', $this->_lang->dashboard->body->select->help);
        @DEFINE('DASHBOARD_BODY_SELECT_DISP', $this->_lang->dashboard->body->select->disp);
        @DEFINE('DASHBOARD_BODY_SELECT_USE1', $this->_lang->dashboard->body->select->use1);
        @DEFINE('DASHBOARD_BODY_SELECT_USE2', $this->_lang->dashboard->body->select->use2);
        @DEFINE('DASHBOARD_BODY_SELECT_DEL', $this->_lang->dashboard->body->select->del);
        @DEFINE('DASHBOARD_BODY_SELECT_MINE', $this->_lang->dashboard->body->select->mine);
        @DEFINE('DASHBOARD_BODY_SELECT_FORMAT', $this->_lang->dashboard->body->select->format);
        @DEFINE('DASHBOARD_BODY_SELECT_UPLOAD', $this->_lang->dashboard->body->select->upload);

        @DEFINE('TOPOLOGI_BODY_ACTION_HTML', $this->_lang->topologi->body->action->html);
        @DEFINE('TOPOLOGI_BODY_ACTION_LOG', $this->_lang->topologi->body->action->log);
        @DEFINE('TOPOLOGI_BODY_ACTION_BACKUP', $this->_lang->topologi->body->action->backup);
        @DEFINE('TOPOLOGI_BODY_ACTION_RESTORE', $this->_lang->topologi->body->action->restore);
        @DEFINE('TOPOLOGI_BODY_ACTION_COMMAND', $this->_lang->topologi->body->action->command);
        @DEFINE('TOPOLOGI_BODY_ACTION_MONITOR', $this->_lang->topologi->body->action->monitor);
        @DEFINE('TOPOLOGI_BODY_INTERFACE_COMPOSANT', $this->_lang->topologi->body->interface->composant);
        @DEFINE('TOPOLOGI_BODY_DETAIL_LINK', $this->_lang->topologi->body->detail->link);
        @DEFINE('TOPOLOGI_BODY_DETAIL_LINK2', $this->_lang->topologi->body->detail->link2);
        @DEFINE('TOPOLOGI_BODY_DETAIL_LINK3', $this->_lang->topologi->body->detail->link3);
        @DEFINE('TOPOLOGI_BODY_DESCRIPTION_COMPOSANT', $this->_lang->topologi->body->description->composant);
        $this->putConstantJs();
    }

    public function putConstantJs()
    {
        @$this->_controller->view->constantJs = array(
            'ADMIN_CONFIG1' => $this->_lang->admin->js->config1,
            'ADMIN_CONFIG2' => $this->_lang->admin->js->config2,
            'MISC_MODIFY' => $this->_lang->misc->js->modify,
            'MISC_ERROR' => $this->_lang->misc->js->error,
            'MISC_SONDE_ERROR' => $this->_lang->misc->js->sonde->error,
            'MISC_DEL' => $this->_lang->misc->js->del,
            'ADMIN_CACHE' => $this->_lang->admin->js->cache->txt,
            'ADMIN_CACHE_EMPTY' => $this->_lang->admin->js->cache->empty,
            'ADMIN_CACHE_SIZE_ALL' => $this->_lang->admin->js->cache->size->all,
            'ADMIN_CACHE_SIZE_SESSION' => $this->_lang->admin->js->cache->size->session,
            'VISU_ERROR_EMPTYSEARCH' => $this->_lang->visualisation->js->error->emptysearch,
            'VISU_ERROR_EMPTYSELECT' => $this->_lang->visualisation->js->error->emptyselect,
            'VISU_ERROR_ENOUGHTSELECT' => $this->_lang->visualisation->js->error->enoughtselect,
            'VISU_ERROR_EMPTYACCOUNT' => $this->_lang->visualisation->js->error->emptyaccount,
            'VISU_BACKUP_SAVE' => $this->_lang->visualisation->js->backup->save,
            'VISU_BACKUP_SUCESS' => $this->_lang->visualisation->js->backup->sucess,
            'VISU_BACKUP_UNSUCESS' => $this->_lang->visualisation->js->backup->unsucess,
            'VISU_RESTORE_TXT' => $this->_lang->visualisation->js->restore->txt,
            'VISU_RESTORE_SUCESS' => $this->_lang->visualisation->js->restore->sucess,
            'VISU_RESTORE_UNSUCESS' => $this->_lang->visualisation->js->restore->unsucess,
            'VISU_CONFIGURATION' => $this->_lang->visualisation->js->configuration,
            'VISU_COMMAND_ERROR' => $this->_lang->visualisation->js->command->error,
            'VISU_COMMAND_ERROR2' => $this->_lang->visualisation->js->command->error2,
            'VISU_COMMAND_ERROR3' => $this->_lang->visualisation->js->command->error3,
            'VISU_LOG_ERROR' => $this->_lang->visualisation->js->log->error,
            'VISU_LOG_TXT' => $this->_lang->visualisation->js->log->txt,
            'VISU_LOG_ADD' => $this->_lang->visualisation->js->log->add,
            'VISU_LOG_UPDATE' => $this->_lang->visualisation->js->log->update,
            'VISU_LOG_EMPTYNAME' => $this->_lang->visualisation->js->log->emptyname,
            'VISU_LOG_DEL' => $this->_lang->visualisation->js->log->del,
            'VISU_SEARCH_ERROR' => $this->_lang->visualisation->js->search->error,
            'VISU_SEARCH_ERROR2' => $this->_lang->visualisation->js->search->error2,
            'VISU_SEARCH_TXT' => $this->_lang->visualisation->js->search->txt,
            'VISU_SEARCH_END' => $this->_lang->visualisation->js->search->end,
            'VISU_SEARCH_STOP' => $this->_lang->visualisation->js->search->stop,
            'VISU_MAP_EXIST' => $this->_lang->visualisation->js->map->exist,
            'VISU_MAP_EMPTY' => $this->_lang->visualisation->js->map->empty,
            'VISU_MAP_LONG' => $this->_lang->visualisation->js->map->long,
            'VISU_TAB_HOSTNAME' => $this->_lang->visualisation->js->tab->hostname,
            'VISU_TAB_IP' => $this->_lang->visualisation->js->tab->ip,
            'VISU_TAB_PORT' => $this->_lang->visualisation->js->tab->port,
            'VISU_TAB_UPTIME' => $this->_lang->visualisation->js->tab->uptime,
            'VISU_TAB_LIST' => $this->_lang->visualisation->js->tab->list,
            'USER_ACCOUNT_PRESENT' => $this->_lang->user->js->account->present,
            'USER_ACCOUNT_DEL_TXT' => $this->_lang->user->js->account->del->txt,
            'USER_ACCOUNT_DEL_SUCESS' => $this->_lang->user->js->account->del->success,
            'USER_NETWORK_TXT' => $this->_lang->user->js->network->txt,
            'USER_NETWORK_DEL' => $this->_lang->user->js->network->del,
            'USER_NETWORK_EMPTY' => $this->_lang->user->js->network->empty,
            'USER_NETWORK_SUCCESS' => $this->_lang->user->js->network->success,
            'USER_RIGHT_TXT' => $this->_lang->user->js->right->txt,
            'USER_RIGHT_DEL' => $this->_lang->user->js->right->del,
            'USER_RIGHT_EMPTYRIGHT' => $this->_lang->user->js->right->emptyright,
            'USER_RIGHT_EMPTYTEMPLATE' => $this->_lang->user->js->right->emptytemplate,
            'USER_RIGHT_BADTEMPLATE' => $this->_lang->user->js->right->badtemplate,
            'USER_ADDUSER_EMPTYFIELD' => $this->_lang->user->js->adduser->emptyfield,
            'USER_ADDUSER_BADLOGIN' => $this->_lang->user->js->adduser->badlogin,
            'USER_ADDUSER_BADMAIL' => $this->_lang->user->js->adduser->badmail,
            'USER_ADDUSER_BADPASSWORD' => $this->_lang->user->js->adduser->badpassword,
            'USER_ADDUSER_DIFFPASSWORD' => $this->_lang->user->js->adduser->diffpassword,
            'USER_ADDUSER_TXT' => $this->_lang->user->js->adduser->txt,
            'USER_ADDUSER_UPDATE' => $this->_lang->user->js->adduser->update,
            'USER_ADDUSER_EXIST' => $this->_lang->user->js->adduser->exist,
            'USER_TXT' => $this->_lang->user->js->user->txt,
            'USER_LOGOUT_TXT' => $this->_lang->user->js->logout->txt,
            'DASHBOARD_FILE' => $this->_lang->dashboard->js->file,
            'DASHBOARD_CONFIG_TXT' => $this->_lang->dashboard->js->config->txt,
            'DASHBOARD_MODULE_SUCCESS' => $this->_lang->dashboard->js->module->success,
            'DASHBOARD_MODULE_ERROR' => $this->_lang->dashboard->js->module->error,
            'DASHBOARD_MODULE_ERROR2' => $this->_lang->dashboard->js->module->error2,
            'DASHBOARD_MODULE_SUCCESS2' => $this->_lang->dashboard->js->module->success2,
            'DASHBOARD_MODULE_SUCCESS3' => $this->_lang->dashboard->js->module->success3,
            'DASHBOARD_MODULE_ERROR3' => $this->_lang->dashboard->js->module->error3,
            'DASHBOARD_LOAD_ERROR' => $this->_lang->dashboard->js->load->error,
            'TOPOLOGI_MONITOR_TXT' => $this->_lang->topologi->js->monitor->txt,
            'TOPOLOGI_MONITOR_ADD' => $this->_lang->topologi->js->monitor->add,
            'SONDE_TAB_CATEGORY' => $this->_lang->sonde->js->tab->category,
            'SONDE_TAB_DATA' => $this->_lang->sonde->js->tab->data,
            'BUTTON_OK' => $this->_lang->button->js->ok,
            'BUTTON_CANCEL' => $this->_lang->button->js->cancel,
            'BUTTON_SEARCH' => $this->_lang->button->js->search,
            'BUTTON_CREATE' => $this->_lang->button->js->create,
            'BUTTON_EXEC' => $this->_lang->button->js->exec,
            'BUTTON_RESTORE' => $this->_lang->button->js->restore,
            'BUTTON_SAVE' => $this->_lang->button->js->save,
            'BUTTON_CREATE_FILTER' => $this->_lang->button->js->createfilter,
            'BUTTON_CLOSE' => $this->_lang->button->js->close,
            'BUTTON_DEL' => $this->_lang->button->js->del,
            'BUTTON_VALID' => $this->_lang->button->js->valid,
            'BUTTON_COMPARE' => $this->_lang->button->js->compare,
            'BUTTON_MODIFY' => $this->_lang->button->js->modify,
            'BUTTON_EMPTY_SESSION' => $this->_lang->button->js->empty->session,
            'BUTTON_EMPTY_ALL' => $this->_lang->button->js->empty->all,
            'BUTTON_YES' => $this->_lang->button->js->yes,
            'BUTTON_NO' => $this->_lang->button->js->no,
        );
//   echo Zend_Json_Encoder::encode($this->_constantJs);
    }

}
